local luoyi = fk.CreateSkill {

  name = "joy__luoyi",

  tags = {  },

}



luoyi:addEffect(fk.DrawNCards, {
  name = "joy__luoyi",
  anim_type = "offensive",
  events = {fk.DrawNCards},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(luoyi.name) and data.n > 0
  end,
  on_cost = function (self, event, target, player, data)
    return player.room:askForSkillInvoke(player,luoyi.name,data,"#joy__luoyi")
  end,
  on_use = function(self, event, target, player, data)
    data.n = data.n - 1
    player.room:setPlayerMark(player,"@@joy__luoyi-turn",1)
  end,
})

luoyi:addEffect(fk.DamageCaused, {
  name = "#joy__luoyi_trigger",
  mute = true,
  events = {fk.DamageCaused},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:getMark("@@joy__luoyi-turn") > 0 and
      not data.chain and data.card and (data.card.trueName == "slash" or data.card.name == "duel")
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:broadcastSkillInvoke("joy__luoyi")
    room:notifySkillInvoked(player, "joy__luoyi")
    data.damage = data.damage + 1
  end,
})

return luoyi